"""
文件夹
"""

import os

from my_typing import *


class File(TypedDict):
    """ 文件信息 """

    name: str
    label: str
    children: list["File"]


struct = [
    {
        "name": "Software",
        "label": "软件",
        "children": [
            {
                "name": "Develop",
                "label": "开发",
                "children": [
                    {
                        "name": "DB",
                        "label": "数据库",
                        "children": [
                            {
                                "name": "MongoDB",
                                "label": "MongoDB 数据库",
                                "children": [
                                    {
                                        "name": "MongoDB6",
                                        "label": "MongoDB 6",
                                        "children": [],
                                    },
                                ],
                            },
                            {
                                "name": "MySQL",
                                "label": "MySQL 数据库",
                                "children": [
                                    {
                                        "name": "MySQL8",
                                        "label": "MySQL 8",
                                        "children": [],
                                    },
                                ],
                            },
                        ],
                    },
                    {
                        "name": "DB Tools",
                        "label": "数据库可视化工具",
                        "children": [
                            {
                                "name": "DBeaver",
                                "label": "MySQL 可视化工具",
                                "children": [],
                            },
                            {
                                "name": "Robot 3T",
                                "label": "MongoDB 可视化工具",
                                "children": [],
                            },
                            {
                                "name": "RedisDesktopManager",
                                "label": "Redis 可视化工具",
                                "children": [],
                            },
                        ],
                    },
                    {
                        "name": "VersionControl",
                        "label": "版本控制",
                        "children": [
                            {
                                "name": "Git",
                                "label": "Git",
                                "children": [],
                            },
                        ],
                    },
                    {
                        "name": "IDE",
                        "label": "集成开发环境",
                        "children": [
                            {
                                "name": "JetBrains",
                                "label": "JetBrains",
                                "children": [
                                    {
                                        "name": "PyCharm",
                                        "label": "Python IDE",
                                        "children": [
                                            {
                                                "name": "PyCharm Community",
                                                "label": "PyCharm 社区版",
                                                "children": [],
                                            },
                                            {
                                                "name": "PyCharm Professional",
                                                "label": "PyCharm 专业版",
                                                "children": [],
                                            },
                                        ],
                                    },
                                    {
                                        "name": "Intellij IDEA",
                                        "label": "Java IDE",
                                        "children": [
                                            {
                                                "name": "Intellij IDEA Community",
                                                "label": "IDEA 社区版",
                                                "children": [],
                                            },
                                        ],
                                    },
                                ],
                            },
                            {
                                "name": "VS Code",
                                "label": "VS Code",
                                "children": [],
                            },
                        ],
                    },
                    {
                        "name": "Python",
                        "label": "Python 解释器",
                        "children": [
                            {
                                "name": "Python37",
                                "label": "Python 3.7",
                                "children": [],
                            },
                            {
                                "name": "Python38",
                                "label": "Python 3.8",
                                "children": [],
                            },
                            {
                                "name": "Virtualenvs",
                                "label": "Python 虚拟环境",
                                "children": [],
                            },
                        ],
                    },
                    {
                        "name": "Java",
                        "label": "Java 开发环境",
                        "children": [
                            {
                                "name": "JDK",
                                "label": "Java 开发工具包",
                                "children": [
                                    {
                                        "name": "JDK8",
                                        "label": "JDK8",
                                        "children": [],
                                    },
                                ],
                            },
                            {
                                "name": "Maven",
                                "label": "Maven",
                                "children": [
                                    {
                                        "name": "Maven 3.9.6",
                                        "label": "Maven 3.9.6",
                                        "children": [],
                                    },
                                ],
                            },
                            {
                                "name": "MavenRepo",
                                "label": "Maven 仓库",
                                "children": [],
                            },
                        ],
                    },
                    {
                        "name": "API Tools",
                        "label": "接口调试工具",
                        "children": [
                            {
                                "name": "Apifox",
                                "label": "Apifox",
                                "children": [],
                            },
                            {
                                "name": "Apipost",
                                "label": "Apipost",
                                "children": [],
                            },
                        ],
                    },
                    {
                        "name": "Terminal",
                        "label": "终端",
                        "children": [
                            {
                                "name": "Windows Terminal",
                                "label": "Windows Terminal",
                                "children": [],
                            },
                            {
                                "name": "MobaXterm",
                                "label": "MobaXterm",
                                "children": [],
                            },
                        ],
                    },
                ],
            },
            {
                "name": "Tools",
                "label": "工具",
                "children": [
                    {
                        "name": "Geek Uninstall",
                        "label": "卸载软件",
                        "children": [],
                    },
                    {
                        "name": "FormatFactory",
                        "label": "格式工厂",
                        "children": [],
                    },
                    {
                        "name": "Bandzip",
                        "label": "解压缩软件",
                        "children": [],
                    },
                    {
                        "name": "Everything",
                        "label": "搜索工具",
                        "children": [],
                    },
                    {
                        "name": "uTools",
                        "label": "效率工具",
                        "children": [],
                    },
                    {
                        "name": "Twinkle Tray",
                        "label": "屏幕亮度调节",
                        "children": [],
                    },
                    {
                        "name": "AS SSD Benchmark",
                        "label": "硬盘测速",
                        "children": [],
                    },
                    {
                        "name": "SamsungMagician",
                        "label": "三星魔术师",
                        "children": [],
                    },
                    {
                        "name": "CrystalDiskInfo",
                        "label": "硬盘信息",
                        "children": [],
                    },
                    {
                        "name": "CrystalDiskMark",
                        "label": "硬盘跑分",
                        "children": [],
                    },
                    {
                        "name": "Snipaste",
                        "label": "截图工具",
                        "children": [],
                    },
                    {
                        "name": "Pixpin",
                        "label": "截图工具",
                        "children": [],
                    },
                    {
                        "name": "ScreenToGif",
                        "label": "动态图制作工具",
                        "children": [],
                    },
                    {
                        "name": "TaskBarTools",
                        "label": "任务栏透明工具",
                        "children": [],
                    },
                    {
                        "name": "TrafficMonitor",
                        "label": "网速、CPU、内存监控工具",
                        "children": [],
                    },
                ],
            },
            {
                "name": "Note",
                "label": "笔记",
                "children": [
                    {
                        "name": "Typora",
                        "label": "Typora",
                        "children": [],
                    },
                    {
                        "name": "YuQue",
                        "label": "语雀",
                        "children": [],
                    },
                ],
            },
            {
                "name": "Office",
                "label": "办公软件",
                "children": [
                    {
                        "name": "LibreOffice",
                        "label": "LibreOffice",
                        "children": [],
                    },
                    {
                        "name": "Microsoft Office 2016",
                        "label": "微软 Office",
                        "children": [],
                    },
                ],
            },
            {
                "name": "Draw",
                "label": "画图",
                "children": [
                    {
                        "name": "drawio",
                        "label": "draw.io",
                        "children": [],
                    },
                ],
            },
            {
                "name": "VM",
                "label": "虚拟机",
                "children": [
                    {
                        "name": "VM Space",
                        "label": "虚拟机空间",
                        "children": [
                            {
                                "name": "Mirror",
                                "label": "系统镜像",
                                "children": [],
                            },
                            {
                                "name": "Installed",
                                "label": "已安装的虚拟机",
                                "children": [],
                            },
                        ],
                    },
                    {
                        "name": "VMware WorkStation",
                        "label": "虚拟机",
                        "children": [],
                    },
                ],
            },
            {
                "name": "Game",
                "label": "游戏",
                "children": [
                    {
                        "name": "WeGame",
                        "label": "WeGame",
                        "children": [],
                    },
                    {
                        "name": "MuMuPlayer",
                        "label": "网易 MuMu",
                        "children": [],
                    },
                ],
            },
            {
                "name": "Explorer",
                "label": "浏览器",
                "children": [
                    {
                        "name": "Google Chrome",
                        "label": "谷歌浏览器",
                        "children": [],
                    },
                    {
                        "name": "SogouExplorer",
                        "label": "搜狗高速浏览器",
                        "children": [],
                    },
                ],
            },
            {
                "name": "Download",
                "label": "下载",
                "children": [
                    {
                        "name": "Thunder",
                        "label": "迅雷",
                        "children": [],
                    },
                    {
                        "name": "BaiduNetDisk",
                        "label": "百度网盘",
                        "children": [],
                    },
                ],
            },
            {
                "name": "Network",
                "label": "网络",
                "children": [
                    {
                        "name": "Clash For Windows",
                        "label": "Clash",
                        "children": [],
                    },
                    {
                        "name": "OpenVPN",
                        "label": "OpenVPN",
                        "children": [],
                    },
                ],
            },
            {
                "name": "Chat",
                "label": "聊天",
                "children": [
                    {
                        "name": "WeChat",
                        "label": "微信",
                        "children": [],
                    },
                    {
                        "name": "QQ",
                        "label": "QQ",
                        "children": [],
                    },
                    {
                        "name": "POPO",
                        "label": "网易泡泡",
                        "children": [],
                    },
                ],
            },
            {
                "name": "Video",
                "label": "视频",
                "children": [
                    {
                        "name": "BaofengVideo",
                        "label": "暴风影音",
                        "children": [],
                    },
                    {
                        "name": "TencentVideo",
                        "label": "腾讯视频",
                        "children": [],
                    },
                ],
            },
            {
                "name": "Music",
                "label": "音乐",
                "children": [
                    {
                        "name": "KuGou",
                        "label": "酷狗音乐",
                        "children": [],
                    },
                    {
                        "name": "NeteaseCloudMusic",
                        "label": "网易云音乐",
                        "children": [],
                    },
                    {
                        "name": "LXMusic",
                        "label": "洛雪音乐助手",
                        "children": [],
                    },
                ],
            },
            {
                "name": "Adobe",
                "label": "Adobe",
                "children": [
                    {
                        "name": "Adobe PhotoShop CC 2019",
                        "label": "PhotoShop",
                        "children": [],
                    },
                    {
                        "name": "Adobe Premiere Pro CC 2019",
                        "label": "Premiere Pro",
                        "children": [],
                    },
                ],
            },
            {
                "name": "Safe",
                "label": "安全",
                "children": [
                    {
                        "name": "HuoRong",
                        "label": "火绒安全",
                        "children": [],
                    },
                ],
            },
            {
                "name": "Input",
                "label": "输入法",
                "children": [
                    {
                        "name": "SogouInput",
                        "label": "搜狗输入法",
                        "children": [],
                    },
                ],
            },
            {
                "name": "Mail",
                "label": "邮件",
                "children": [
                    {
                        "name": "MailMaster",
                        "label": "网易邮箱大师",
                        "children": [],
                    },
                ],
            },
        ],
    },
]


def create_folders(
    file_list: list[File],
    parent_path: str = "",
) -> None:
    """
    创建文件夹

    Args:
        file_list: 文件信息列表
        parent_path: 父级文件夹路径
    """

    for file in file_list:
        current_path = os.path.join(parent_path, file["name"])
        os.makedirs(current_path, exist_ok=True)

        create_folders(file["children"], current_path)


create_folders(struct, "./")
